<?php

namespace App\Traits\Relation;

use App\Models\Service;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;

/**
 * 用于定义快递员和其他模型的关系
 *
 * @package App\Traits\Relation
 * Date: 2018/05/28
 * @author Tenny
 */
trait CourierRelation
{
    /**
     * 获取关联站点数
     *
     * Date: 2018/06/10
     * @author Tenny
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function services()
    {
        return $this->belongsToMany(Service::class, 'network_express', 'network_id', 'service_id', 'id', 'id');
    }
}
